function createApp(rootComponent) {
  return {
    mount(selector) {
      let isMoounted = false
      let oldVnode = null

      watchEffect(function() {
        if (!isMoounted) {
          oldVnode = rootComponent.render()
          const container = document.querySelector(selector)
          mount(oldVnode, container)
          isMoounted = true
        } else {
          let newVnode = rootComponent.render()
          patch(oldVnode, newVnode)
          oldVnode = newVnode
        }
      })
      
    }
  }
}